/**
 * @param {string} s
 * @return {string}
 */
var greatestLetter = function(s) {
  let recordSmall = new Array(26).fill(false), recordBig = new Array(26).fill(false);
  for(let i = 0; i < s.length; i++) {
    if(s[i] <= 'z' && s[i] >= 'a') {
      recordSmall[s[i].charCodeAt() - 'a'.charCodeAt()] = true;
    } else {
      recordBig[s[i].charCodeAt() - 'A'.charCodeAt()] = true;
    }
  }
  let temp = -1, result = ['A'];
  for(let i = 0; i < 26; i++) {
    if(recordSmall[i] && recordBig[i]) {
      temp = i;
    }
  }
  if(temp == -1)
    return "";
  return String.fromCharCode(temp + 'A'.charCodeAt());

};
let s = "lEeTcOdE";
console.log(greatestLetter(s));
s = "arRAzFif";
console.log(greatestLetter(s));
s = "AbCdEfGhIjK";
console.log(greatestLetter(s));
